package com.gx.mxbbx.service.impl;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gx.mxbbx.dao.ReimbursementMapper;
import com.gx.mxbbx.po.Area;
import com.gx.mxbbx.po.Disease;
import com.gx.mxbbx.po.Reimbursement;
import com.gx.mxbbx.po.Rural;
import com.gx.mxbbx.service.ReimbursementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.security.PublicKey;
import java.sql.Timestamp;
import java.util.List;

@Service
@Transactional
public class ReimbursementServiceImpl implements ReimbursementService {
    @Autowired
    private ReimbursementMapper reimbursementMapper;

    public PageInfo<Reimbursement> getReimList(String fullName, Integer currentPage, Integer limit) {
        PageHelper.startPage(currentPage, limit);
        List<Reimbursement> list = reimbursementMapper.getReimList(fullName);
        PageInfo<Reimbursement> pageInfo = new PageInfo<Reimbursement>(list);
        return pageInfo;
    }

    public String reimbursement(String identityCard) {
        String p = reimbursementMapper.reimbursement(identityCard);
        return p;
    }

    public Rural getreimbursementlist(String identityCard) {
        Rural rural = reimbursementMapper.getreimbursementlist(identityCard);
        return rural;
    }

    public Disease getDisease(String identityCard) {
        Disease disease = reimbursementMapper.getDisease(identityCard);
        return disease;
    }

    public void reimbursementadd(Reimbursement reimbursement) {
        reimbursement.setCreateTime(new Timestamp(System.currentTimeMillis()));
        reimbursementMapper.reimbursementadd(reimbursement);
    }

    public void udaterural(Reimbursement reimbursement) {
        reimbursementMapper.udaterural(reimbursement);
    }

    public void reimbursementdelete(Integer id) {
        reimbursementMapper.reimbursementdelete(id);
    }
}
